﻿@{
    var tableName = PageViewModel.PageTableID(this);
    var orgTreeName = PageViewModel.ControlID(this, "ul_org_tree");

    var onSelectOrgNode = PageViewModel.PageFunctionName(this, "on_select_org");
}

<style type="text/css">
    #@orgTreeName .tree-node{  height:32px;line-height:32px; }
    #@orgTreeName .tree-node .tree-file{  background-image: none; }
    #@orgTreeName .tree-node .tree-folder{  background-image: none; }
    #@orgTreeName .tree-node .tree-folder-open{  background-image: none; }
</style>

<script type="text/javascript">
    function @onSelectOrgNode (node) {
        if (node.NodeType == "ORG") {
            $('#@tableName').datagrid('load', {
                OrganizationID: node.OrgID/ @admin.cyt369.com.Models.Orgs.OrgTreeConvert.ConvertVal,
            });
        } else if (node.NodeType == "DEPT") {
            $('#@tableName').datagrid('load', {
                DepartmentID: node.Id,
            });
        }
    }
</script>

<ul id="@orgTreeName" class="easyui-tree" fit="true" data-options="url:'~/Systems/GetOrgDeptTrees',method:'get',onSelect:@onSelectOrgNode"></ul>
